package com.collectionAndMap.collection.set;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/***
 * @ClassName: SetDemo
 * @Description:
 * @Auther: 送一一块二向箔
 * @Date: 15:24 2022/2/17
 * @version : V1.0
 */
public class SetDemo {
    public static void main(String[] args) {
        Set<String> set = new HashSet();
        set.add("华为");
        set.add("苹果");
        set.add("小米");

        //遍历,没有脚标只能使用增强for
        for (String s : set) {
            System.out.println(s);
        }
        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
        boolean oppo = set.contains("oppo");
        System.out.println(oppo);
    }
}
